<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                xmlns:security="http://www.springframework.org/security/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">用户标签库</ui:define>
    <ui:define name="content">
        <h:form>
            <p:defaultCommand target="search"/>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="left">
                        <p:commandButton id="toggler" type="button" value="展示选择"
                                         style="width: auto;"
                                         icon="ui-icon-calculator"
                                         rendered="#{security:areAllGranted('LOAN_FAMILY_TAGS_FIRST_PARTY_SEARCH')}"/>
                        <p:columnToggler datasource="dictionaryDataTable" trigger="toggler"
                                         rendered="#{security:areAllGranted('LOAN_FAMILY_TAGS_FIRST_PARTY_SEARCH')}"/>
                    </f:facet>
                    <f:facet name="right">
                        <p:commandButton id="search" value="查询" icon="fa fa-search"
                                         update="@form"
                                         rendered="#{userTagListBean.isNormal() and security:areAllGranted('LOAN_FAMILY_TAGS_FIRST_PARTY_SEARCH')}"/>
                        <p:commandButton value="重置" icon="fa fa-refresh"
                                         actionListener="#{userTagListBean.onReset}"
                                         process="@this"
                                         update="@form"
                                         rendered="#{userTagListBean.isNormal() and security:areAllGranted('LOAN_FAMILY_TAGS_FIRST_PARTY_SEARCH')}"/>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="ui-g">
                    <div class="ui-g-12">
                        <div class="card">
                            <h1>查询条件</h1>
                            <p:panelGrid columns="8" layout="grid"
                                         columnClasses="ui-grid-col-1,ui-grid-col-2"
                                         styleClass="ui-panelgrid-blank"
                                         style="border:0px none; background-color:transparent;">

                                <p:outputLabel for="userId" value="用户ID"/>
                                <p:inputText id="userId" value="#{userTagListBean.$.userId}"/>

                                <p:outputLabel for="petname" value="姓名"/>
                                <p:inputText id="petname" value="#{userTagListBean.$.petname}"/>

                                <p:outputLabel for="mobnum" value="手机号码"/>
                                <p:inputText id="mobnum" value="#{userTagListBean.$.mobnum}"/>

                                <p:outputLabel for="idcard" value="身份证"/>
                                <p:inputText id="idcard" value="#{userTagListBean.$.idcard}"/>

                                <p:outputLabel for="profession" value="身份标签"/>
                                <p:selectOneMenu id="profession" value="#{userTagListBean.$.profession}">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                    <f:selectItems
                                            value="#{userTagListBean.dictionaries[DictionaryCode.USER_IDENTITY_TAG]}"
                                            var="dic"
                                            itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                                </p:selectOneMenu>
                                <p:outputLabel for="faceIdAuth" value="FaceId认证"/>
                                <p:selectOneMenu id="faceIdAuth" value="#{userTagListBean.$.faceIdAuth}">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                    <f:selectItem itemLabel="已通过" itemValue="1"/>
                                    <f:selectItem itemLabel="未通过" itemValue="0"/>
                                    <f:selectItem itemLabel="未认证" itemValue="2"/>
                                </p:selectOneMenu>
                                <p:outputLabel for="ispAuth" value="运营商授权"/>
                                <p:selectOneMenu id="ispAuth" value="#{userTagListBean.$.ispAuth}">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                    <f:selectItem itemLabel="已通过" itemValue="1"/>
                                    <f:selectItem itemLabel="未通过" itemValue="0"/>
                                    <f:selectItem itemLabel="未认证" itemValue="2"/>
                                </p:selectOneMenu>
                                <p:outputLabel for="isHaveCredit" value="是否有信用卡"/>
                                <p:selectOneMenu id="isHaveCredit" value="#{userTagListBean.$.isHaveCredit}">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                    <f:selectItem itemLabel="拥有" itemValue="1"/>
                                    <f:selectItem itemLabel="没有" itemValue="0"/>
                                    <f:selectItem itemLabel="未填" itemValue="2"/>
                                </p:selectOneMenu>
                            </p:panelGrid>
                        </div>
                        <div class="card">
                            <p:dataTable id="dictionaryDataTable"
                                         style="width: 100%"
                                         var="userInfo"
                                         value="#{userTagListBean.lazyDataModel}"
                                         rows="#{constants:get('ROWS')}"
                                         lazy="true"
                                         paginator="true"
                                         paginatorTemplate="#{constants:get('PAGINATOR_TEMPLATE')}"
                                         rowsPerPageTemplate="#{constants:get('ROWS_PER_PAGE_TEMPLATE')}"
                                         emptyMessage="#{constants:get('EMPTY_MESSAGE')}"
                                         scrollable="true"
                                         scrollWidth="97%"
                                         reflow="true"
                                         resizableColumns="true"
                                         rendered="#{security:areAllGranted('LOAN_FAMILY_TAGS_FIRST_PARTY_SEARCH')}">


                                <p:column headerText="操作" rendered="#{userTagListBean.isNotBatch()}">
                                    <p:splitButton icon="fa fa-eye"
                                                   action="#{userTagListBean.onEdit(userInfo.id)}"
                                                   process="@this">
                                        <f:setPropertyActionListener
                                                value="/views/family/tags/user/list.xhtml"
                                                target="#{currentUserBean.back}"/>
                                    </p:splitButton>
                                </p:column>
                                <p:column headerText="姓名">
                                    <h:outputText value="#{userInfo.petname}"/>
                                </p:column>
                                <p:column headerText="身份证">
                                    <h:outputText value="#{userTagListBean.desensitize(userInfo.idcard)}"/>
                                </p:column>
                                <p:column headerText="手机号">
                                    <h:outputText value="#{userTagListBean.desensitize(userInfo.mobnum)}"/>
                                </p:column>
                                <p:column headerText="身份标签">
                                    <h:outputText value="#{userInfo.profession}"/>
                                </p:column>
                                <p:column headerText="百度金融命中">
                                    <h:outputText value="#{userInfo.baiduJRLevel}"/>
                                </p:column>
                                <p:column headerText="芝麻分">
                                    <h:outputText value="#{userInfo.sesamePoint}"/>
                                </p:column>
                                <p:column headerText="信用卡">
                                    <h:outputText value="#{userInfo.credit}"/>
                                </p:column>
                            </p:dataTable>
                        </div>
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>
